]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Handle symbolic OSK key codes as explicitly invalid
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Fri, 12 Mar 2021 06:45:19 +0000 (14:45 +0800)
committerMarge Bot <marge-bot@gnome.org>
Mon, 15 Mar 2021 12:41:10 +0000 (12:41 +0000)
`key` is an empty string in this case, causing `charCodeAt(0)` to return
`NaN`, which when passed to `Clutter.unicode_to_keysym` now generates an
error in gjs >= 1.67.3:

```
JS ERROR: Error: Argument wc: value is out of range for uint32
```

And the symbolic keys like Backspace, Enter and Caps Lock would have their
presses ignored.

Just skip the call to `charCodeAt` that will fail and allow
`Clutter.unicode_to_keysym` to return its usual error flag.

Fixes: https://bugs.launchpad.net/bugs/1918738
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1758>

js/ui/keyboard.js

index 7452feaac54e5b485daa88e6fcdfd27976ca6a1a..866382e4fe1dedef34bc43560a3b412aafaee26d 100644 (file)
@@ -327,7 +327,7 @@ var Key = GObject.registerClass({
     }
 
     _getKeyval(key) {
-        let unicode = key.charCodeAt(0);
+        let unicode = key.length ? key.charCodeAt(0) : undefined;
         return Clutter.unicode_to_keysym(unicode);
     }